/*
 *  shared_state.c
 *  xbox360wireless_receiver
 *
 *  Created by Delio Brignoli on 11/12/08.
 *  Copyright 2008 Delio Brignoli. All rights reserved.
 *
 */

#include "shared_state.h"

static HEADSET_STATE headsets[MAX_XBOX_DEVICES];
static CONTROLLER_STATE controllers[MAX_XBOX_DEVICES];

HEADSET_STATE GET_HEADSET_STATE(int headset_num) {
	if (headset_num < 0 || headset_num >= MAX_XBOX_DEVICES)
		return -1;
	return headsets[headset_num];
}

int SET_HEADSET_STATE(int headset_num, HEADSET_STATE state) {
	if (headset_num < 0 || headset_num >= MAX_XBOX_DEVICES)
		return -1;
	headsets[headset_num] = state;
	return 0;
}

HEADSET_STATE GET_CONTROLLER_STATE(int controller_num) {
	if (controller_num < 0 || controller_num >= MAX_XBOX_DEVICES)
		return -1;
	return controllers[controller_num];
}

int SET_CONTROLLER_STATE(int controller_num, CONTROLLER_STATE state) {
	if (controller_num < 0 || controller_num >= MAX_XBOX_DEVICES)
		return -1;
	controllers[controller_num] = state;
	return 0;
}
